Component({
  options: {
    addGlobalClass: true
  },
  properties: {
    group: {
      type:Number,
      value:0
    },
    goods: {
      type:Array,
      value:[]
    },
    index: {
      type:Number,
      value:-1
    }
  },
  data: {
    infos: [
      {tip:'商家已退款，退回资金将原路三个工作日返回您的账户',type:'退款',b1:'修改运单号',b2:'查看物流'},
      {tip:'商家已审核确认，预计1小时内发起退款',type:'退货',b1:'',b2:'填写运单号'},
      {tip:'商家将尽快确认您的退款申请',type:'退货',b1:'',b2:'撤销申请'},
      {tip:'退款/售后已完成',type:'退货',b1:'',b2:''}
    ],
    totalPrice:0,
    postage:5.0,
  },
  lifetimes: {
    attached(){
      let totalPrice=0;
      for(let i=0;i<this.properties.goods.length;i++){
        totalPrice+=this.properties.goods[i].price*this.properties.goods[i].numBuys;
      }
      this.setData({totalPrice:totalPrice});
    }
  },
  methods: {
    clickBtn(e) {
      //console.log('clickBtn:',e);
      let name=e.detail.name;
      let url;
      if(name.indexOf('运单号')>-1)url='/pages/usercenter/after-selling/tracking-edit/index';
      if(name=='查看物流')url='/pages/usercenter/after-selling/tracking-info/index';
      if(!url){
        wx.showToast({
          title: name,
        });
        return;
      }
      wx.navigateTo({url: url});
    },
    toRefund(e) {
      this.triggerEvent('toDetail',{index:this.properties.index});
    },
  }
})
